package com.foreveredu.propms.service;

import java.util.List;

import com.foreveredu.propms.domain.Account;
import com.foreveredu.propms.domain.Bill;
import com.foreveredu.propms.domain.BillOther;
import com.foreveredu.propms.domain.ChargeRecord;
import com.foreveredu.propms.domain.Exchange;
import com.foreveredu.propms.domain.House;
import com.foreveredu.propms.domain.Owner;
import com.foreveredu.propms.domain.SubAccount;
import com.foreveredu.propms.domain.SubDistrict;
import com.foreveredu.propms.domain.Utilities;

public interface IBusinessService {

	/*
	 * 根据房产和日期查找收费记录
	 */
	List<ChargeRecord> findChargeRecordByHouseAndDate(House house, int year, int month);
	
	/*
	 * 计算房产在某日期（月份）的收费记录
	 */	
	void countChargeRecordForHouseAndDate(House house, int year, int month);
	
	/*
	 * 计算所有房产在某日期（月份）的收费记录
	 */	
	void calAllHousesChargeRecord(int year, int month);
	
	//查询某账单所包含的收费记录列表
	List<ChargeRecord> findChargeRecordsByBill(Bill bill);

	
	/*
	 * Utilities水电气数据记录对象的业务逻辑处理
	 */	
	void saveUtilities(Utilities utilities);

	void deleteUtilitiesById(int id);

	void updateUtilities(Utilities utilities);

	List<Utilities> findUtilitiess();

	Utilities findUtilitiesById(int id);

	Utilities findUtilitiesByHouseAndDate(House house, int year, int month);
	
	/*
	 * Bill账单对象的业务逻辑处理
	 */	
	void saveBill(Bill bill);

	void deleteBillById(int id);

	void updateBill(Bill bill);

	List<Bill> findBills();

	Bill findBillById(int id);

	/*
	 * Account账单对象的业务逻辑处理
	 */	
	void saveAccount(Account account);

	void deleteAccountById(int id);

	void updateAccount(Account account);

	List<Account> findAccounts();

	Account findAccountById(int id);

	/*
	 * Exchange账单对象的业务逻辑处理
	 */	
	void saveExchange(Exchange exchange);

	void deleteExchangeById(int id);

	void updateExchange(Exchange exchange);

	List<Exchange> findExchanges();

	Exchange findExchangeById(int id);

	/*
	 * SubAccount子账单对象的业务逻辑处理
	 */	
	void saveSubAccount(SubAccount subAccount);

	void deleteSubAccountById(int id);

	void updateSubAccount(SubAccount subAccount);

	List<SubAccount> findSubAccounts();

	SubAccount findSubAccountById(int id);
	
	//以小区为单位，每月生成各房产的账单，账单包含了该房产应缴的全部物业费用。
	void createBillForHouseOfSubDistrict(SubDistrict subDistrict, int year, int month) throws Exception;

	//查找某房产某月份的账单
	Bill findBillByHouseAndMonth(House house, int year, int month);

	//删除某房产某月份的水电数据
	void deleteUtilitiesByHouseAndDate(House house, int chargeYear, int chargeMonth);

	//返回业主的账户
	Account findAccountByOwner(Owner owner);

	//查找某房产的历史欠款
	float findHistoryDebtOfHouse(House house);

	//查询某房产的历史欠费账单信息
	Bill findHistoryBillOfHouse(House house);

	//统计业主的全部房产的历史欠款
	float findHistoryDebtOfOwner(Owner owner);

	//查找某房产的所有未付账单
	List<Bill> findNotPaidBillsOfHouse(House house);
	
	//查找某房产的所有账单
	List<Bill> findBillsOfHouse(House house);

	//查找某账户下的指定类型的子账户
	SubAccount findSubAccountByType(Account account, int type);
	
	/*
	 * BillOther账单对象的业务逻辑处理
	 */	

	List<BillOther> findBillOthers();

	BillOther findBillOtherById(int id);

	List<Bill> findBillsByBillOther(BillOther billOther);

	
}
